package md.lanjing.com.module_deal_center.ui.adapter;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

public class CommonFragmentPagerAdapter extends FragmentPagerAdapter {
    String titleArr[];
    List<Fragment> mFragmentList;
    public CommonFragmentPagerAdapter(FragmentManager fm, List<Fragment> list, String[]titleArr) {
        super(fm);
        mFragmentList=list;
        this.titleArr=titleArr;
    }

    @Override
    public Fragment getItem(int i) {
        return mFragmentList.get(i);
    }

    @Override
    public int getCount() {
        return mFragmentList!=null?mFragmentList.size():0;
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return titleArr[position];
    }
}
